/*
 * @Author: weisheng
 * @Date: 2023-04-17 12:51:22
 * @LastEditTime: 2023-04-20 15:01:53
 * @LastEditors: weisheng
 * @Description:
 * @FilePath: \uniapp-vue3-fant-ts\src\api\DemoApi.ts
 * 记得注释
 */
import http from '@/http/HttpClient'
import BaseResponse from '@/model/BaseResponse'
import Chanel from '@/model/Chanel'
import UserInfo from '@/model/UserInfo'
import {getParams} from "@/utils/common";
// 这里将API方法统一管理
export default class CommonApi {
  static getCodeImg(): Promise<BaseResponse<Chanel[]>> {
    // @ts-ignore
      return http
      .server()
      .get(`/cityAdmin/mall/open/img_code`, {
        headers: {
          isToken: false
        },
        method: 'get',
        responseType: 'arraybuffer',
        timeout: 20000
      })
      .then((res) => { 
        return res
      })
  }
  
  static qiniuSingleUpload(data): Promise<BaseResponse<Chanel[]>> {
    return http
      .server()
      .post('/cityAdmin/mall/open/v2/qiniu_single_upload?resetName=true', data, {})
      .then((res) => {
        return res.data
      })
  }
  
  static postWithdrawal(data): Promise<BaseResponse<Chanel[]>> {
    return http
      .server()
      .post('/cityAdmin/mall/finance_clear/v2/withdrawal', data, {})
      .then((res) => {
        return res.data
      })
  }
  
  static putFeedback(data): Promise<BaseResponse<Chanel[]>> {
    return http
      .server()
      .post('/cityUser/api/mime/issue/v1/commit', data, {})
      .then((res) => {
        return res.data
      })
  }
  
  static goodsAddEdit(data): Promise<BaseResponse<Chanel[]>> {
    return http
      .server()
      .post('/cityAdmin/mall/goods/v2/add_edit', data, {})
      .then((res) => {
        return res.data
      })
  }
  
  
  static getBalance(): Promise<BaseResponse<Chanel[]>> {  
    // @ts-ignore
      return http
      .server()
      .get(`/cityAdmin/mall/finance_clear/balance`, {
        headers: {
          isToken: false
        },
        method: 'get',
        responseType: 'arraybuffer',
        timeout: 20000
      })
      .then((res) => {
        return res
      })
  }
  static getWithdrawalParam(): Promise<BaseResponse<Chanel[]>> {
    // @ts-ignore
      return http
      .server()
      .get(`/cityAdmin/mall/finance_clear/v2/withdrawal_param`, {
        headers: {
          isToken: false
        },
        method: 'get',
        responseType: 'arraybuffer',
        timeout: 20000
      })
      .then((res) => {
        return res
      })
  }
  static getSendCode(data): Promise<BaseResponse<Chanel[]>> {
    return http
      .server()
      .get(`/cityAdmin/mall/open/send_code${data}`, {})
      .then((res) => {
        return res.data
      })
  }
  static getMallInfo(data): Promise<BaseResponse<Chanel[]>> {
    return http
      .server()
      .get(`/cityAdmin/mall/main/v2/mall_info${data}`, {})
      .then((res) => {
        return res.data
      })
  }
  
  static getArticleInfo(data): Promise<BaseResponse<Chanel[]>> {
    return http
      .server()
      .get(`/cityAdmin/api/article/v2/info${data}`, {})
      .then((res) => {
        return res.data
      })
  }
  
  static getGoodsInfo(data): Promise<BaseResponse<Chanel[]>> {
    return http
      .server()
      .get(`/cityAdmin/mall/goods/v2/info${data}`, {})
      .then((res) => {
        return res.data
      })
  }

    static getAppVersion(data): Promise<BaseResponse<Chanel[]>> {
        return http
            .server()
            .get(`/cityAdmin/admin/app_version/version${getParams(data)}`, {})
            .then((res) => {
                return res.data
            })
    }
    static getAppVersionList(data): Promise<BaseResponse<Chanel[]>> {
        return http
            .server()
            .get(`/cityAdmin/admin/app_version/list_data${getParams(data)}`, {})
            .then((res) => {
                return res.data
            })
    }
}
